package br.com.rpteixeira.util;

import java.lang.reflect.ParameterizedType;


public class UtilGenerics {
	public static Class<?> getFirstDeclaredArgument(Class<?> clazz) {
		return getTypeArgument(clazz, 0);
	}
	public static Class<?> getTypeArgument(Class<?> clazz, Integer position) {
		return (Class<?>) ((ParameterizedType) clazz.getGenericSuperclass()).getActualTypeArguments()[position];
	} 
	
}